﻿using System;
using System.Drawing;
using System.IO;
using System.Text;

namespace Clotho.Keyword {
	/// <summary>
	/// 情节拥有要点的属性
	/// </summary>
	public class KeywordFeature : IFeature {
		public const string TYPEWORD = "要点";
		public override string Type_word => TYPEWORD;

		public KeywordFeature(IItem parent, string name) : base(parent, name) {}


		public override IFeature Clone(IItem parent) {
			throw new NotImplementedException();
		}
	}
	/// <summary>
	/// 共用的，描述要点特性的属性。
	/// </summary>
	public class KeywordDescFeature : IFeature {
		public const string TYPEWORD = "要点描述";
		private Color backgrond_color;
		private string one_word;
		private string image_link;

		public override string Type_word => TYPEWORD;
		public Color Backgrond_color { get => backgrond_color; set => backgrond_color = value; }
		public string One_word { get => one_word; set => one_word = value; }
		public string Image_link { get => image_link; set => image_link = value; }
		public KeywordDescFeature(IItem parent, string name) : base(parent, name) { }

		public override IFeature Clone(IItem parent) {
			KeywordDescFeature var = new KeywordDescFeature(parent, Name);
			var.backgrond_color = backgrond_color;
			var.one_word = one_word;
			var.image_link = image_link;
			return var;
		}
		protected override void writeDatas(StringBuilder sb) {
			sb.Append(delimiter); sb.Append(One_word);
			sb.Append(delimiter); sb.Append(Backgrond_color.ToArgb().ToString());
			sb.Append(delimiter); sb.Append(Image_link);
			return;
		}
		public override void loadData(string[] ss) {
			One_word = ss[1];
			Backgrond_color = Color.FromArgb(Int32.Parse(ss[2]));
			Image_link = ss[3];
		}
	}
}